package com.fit.components;

import org.apache.tapestry5.annotations.Import;
import org.apache.tapestry5.annotations.OnEvent;
import org.apache.tapestry5.annotations.Property;
import org.apache.tapestry5.annotations.SessionState;
import org.apache.tapestry5.ioc.annotations.Inject;

import com.fit.services.BasicAuthenticator;

@Import(stylesheet = { "context:template/styles/layout.css",
		"context:template/styles/wysiwyg.css",
		"context:template/themes/blue/styles.css" }, library = {
		"context:template/scripts/jquery.wysiwyg.js",
		"context:template/scripts/visualize.jQuery.js",
		"context:template/scripts/functions.js",
		"context:template/scripts/filterTable.js"
		})
public class ManTemplate {
	@SessionState
	@Property
	private BasicAuthenticator basic;

	@OnEvent(component = "logoutLink")
	Object onLogoutLink() {
		basic.logout();
		return null;
	}

	public boolean isAdmin() {
		if (basic.getLoggedUser().getType().equalsIgnoreCase("admin")) {
			return true;
		}
		return false;
	}

}
